'use strict';

exports.__esModule = true;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var RequestError = function () {
  function RequestError(status, statusText, errors) {
    (0, _classCallCheck3.default)(this, RequestError);

    this.name = 'RequestError';
    this.status = status;
    this.statusText = statusText || 'Request Error';
    this.errors = errors;
  }

  RequestError.prototype.formatErrorMessage = function formatErrorMessage() {
    var errorMsg = this.status + ' ' + this.statusText;

    if (this.errors) {
      errorMsg = typeof this.errors === 'string' ? this.errors : this.errors.join('\n');
    }

    return errorMsg;
  };

  return RequestError;
}();

exports.default = RequestError;